package com.anti.modular.bus.busroom.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.anti.commom.core.utils.StringUtils;
import com.anti.commom.pojo.BaseValidatedGroup;
import com.anti.core.context.login.LoginContextHolder;
import com.anti.jdbc.DBUtils;
import com.anti.jdbc.support.page.PageParam;
import com.anti.jdbc.support.page.PageResult;
import com.anti.commom.core.exception.BusinessException;
import com.anti.modular.bus.basicinformation.entity.BasicInformation;
import com.anti.modular.bus.basicinformation.service.BasicInformationService;
import com.anti.modular.bus.busrealestate.enums.BusRealEstateExceptionEnum;
import com.anti.modular.bus.busrealestate.result.BusRoomResult;
import com.anti.modular.bus.busrealestate.result.RoomRentDesResult;
import com.anti.modular.bus.busrealestate.result.RoomType;
import com.anti.modular.bus.busrealestate.result.tree.BusRoomTreeRes;
import com.anti.modular.bus.busrealestate.result.tree.RoomItemResult;
import com.anti.modular.bus.busrealestate.result.tree.RoomListResult;
import com.anti.modular.bus.busrealestatefloor.entity.BusRealEstateFloor;
import com.anti.modular.bus.busrealestatefloor.service.BusRealEstateFloorService;
import com.anti.modular.bus.busroom.entity.BusRoom;
import com.anti.modular.bus.busroom.enums.BusRoomExceptionEnum;
import com.anti.modular.bus.busroom.param.BusRoomParam;
import com.anti.modular.bus.busroom.service.BusRoomService;
import com.anti.modular.bus.roomdeposit.entity.RoomDeposit;
import com.anti.modular.bus.roomdeposit.service.RoomDepositService;
import com.anti.modular.bus.roomexpenses.entity.RoomExpenses;
import com.anti.modular.bus.roomexpenses.service.RoomExpensesService;
import com.anti.modular.bus.roomfurniture.entity.RoomFurniture;
import com.anti.modular.bus.roomfurniture.service.RoomFurnitureService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

/**
 * 房间表service接口实现类
 *
 * @author anti
 * @date 2021-04-16 19:14:02
 */
@Service
public class BusRoomServiceImpl implements BusRoomService {
    @Resource
    DBUtils dbUtils;
    @Resource
    BusRealEstateFloorService busRealEstateFloorService;
    @Resource
    BasicInformationService basicInformationService;
    @Resource
    RoomDepositService roomDepositService;
    @Resource
    RoomExpensesService roomExpensesService;
    @Resource
    RoomFurnitureService roomFurnitureService;

    @Override
    public BusRoom getById(BusRoomParam busRoomParam){
        String sql="select * from bus_room where id =? ";
        return dbUtils.get(sql,BusRoom.class,busRoomParam.getId());
    }

    @Override
    public BusRoom getByLeaseId(Long id) {
        String sql="select * from bus_room where leaseid =? ";
        return dbUtils.get(sql,BusRoom.class,id);
    }

    @Override
    public List<BusRoomResult> getByIds(List<Long> ids, String searchType, String searchValue) {

        StringBuilder sql=new StringBuilder("select a.*,(select count(*) from room_reservation where room_id = a.id and status=0) as reservation  from bus_room a LEFT JOIN house_lease b on a.id=b.room_id and b.lease_status<>2 where a.estateid in (:ids) and a.status=0");
        HashMap<Object, Object> hashMap = CollectionUtil.newHashMap();
        hashMap.put("ids",ids);
        //'' 默認查詢  0 房間名查詢 1 狀態查詢 2 戶型查詢
        if ("0".equals(searchType)&&StringUtils.isNotBlank(searchValue)){
            sql.append(" and a.code = :code");
            hashMap.put("code",searchValue);
        }else if("1".equals(searchType)){
            // 閑置
            if ("2".equals(searchValue)){
                sql.append(" and a.lease = :lease");
                hashMap.put("lease",0);
            }
            // 已租
            if ("3".equals(searchValue)){
                sql.append(" and a.lease = :lease");
                hashMap.put("lease",1);
            }
            //預定
            if ("4".equals(searchValue)){
                sql.append(" and a.id in (select room_id from room_reservation where status = 0)");
            }
            //收租
            if ("5".equals(searchValue)){
                sql.append(" and a.lease = 1 and b.status=0 and b.lease_status<>2 and EXISTS (select * from  house_bill where status=0 and house_lease_id=b.id and bill_status in (0,3) and  rented_day>=DATE_FORMAT(DATE_ADD(NOW(),INTERVAL -7 DAY),'%Y-%m-%d')  and  rented_day<= DATE_FORMAT(NOW(),'%Y-%m-%d'))");
            }
            //逾期
            if ("6".equals(searchValue)){
                sql.append(" and a.lease = 1 and b.status=0 and b.lease_status<>2 and EXISTS (select * from  house_bill where status=0 and house_lease_id=b.id and bill_status in (0,3) and DATE_FORMAT(rented_day,'%Y-%m-%d')<DATE_FORMAT(NOW(),'%Y-%m-%d'))");
            }
            //無賬單
            if ("7".equals(searchValue)){
                sql.append(" and a.id in (select room_id from room_reservation where status = 0)");
            }
            //租约到期
            if ("8".equals(searchValue)){
                sql.append(" and a.lease = 1 and b.status=0 and b.lease_status<>2 and DATE_FORMAT(b.rent_end_date,'%Y-%m-%d')<DATE_FORMAT(NOW(),'%Y-%m-%d')");
            }
        }else if ("2".equals(searchType)&&StringUtils.isNotBlank(searchValue)){
            sql.append(" and a.room_type = :roomType");
            hashMap.put("roomType",searchValue);
        }
        sql.append(" order by code asc");
        return dbUtils.query(sql.toString(),BusRoomResult.class,hashMap);
    }

    @Override
    public List<BusRoom> getByFloorIds(List<Long> ids) {
        StringBuilder sql=new StringBuilder("select * from bus_room where floorid in (:ids) and status=0");
        HashMap<Object, Object> hashMap = CollectionUtil.newHashMap();
        hashMap.put("ids",ids);
        return dbUtils.query(sql.toString(),BusRoom.class,hashMap);
    }

    @Override
    public List<BusRoomTreeRes> getBusRoomTreeResFloorIds(List<Long> ids) {
        StringBuilder sql=new StringBuilder("select a.id,a.floorid,a.estateid,a.code,a.lease,(select count(*) from room_reservation where status=0 and room_id =a.id) as reservation ,(select name from house_lease where room_id=a.id and status=0 and lease_status<>2 ) as name from bus_room a where a.floorid in (:ids) and a.status=0");
        HashMap<Object, Object> hashMap = CollectionUtil.newHashMap();
        hashMap.put("ids",ids);
        return dbUtils.query(sql.toString(),BusRoomTreeRes.class,hashMap);
    }

    @Override
    public int getRoomCount(Long fcId, String type) {
        ArrayList<Object> objects = CollectionUtil.newArrayList();
        StringBuilder sb=new StringBuilder("select count(*) from bus_room where status=0 ");
        if (type.equals("1")){
            sb.append(" and estateid =? ");
            objects.add(fcId);
        }else {
            sb.append(" and estateid in (select id from bus_real_estate where category=2 and status=0) ");
        }

        return dbUtils.getIntValue(sb.toString(),objects.toArray());
    }

    @Override
    public int getRoomRentCount(Long fcId, String type) {
        ArrayList<Object> objects = CollectionUtil.newArrayList();
        StringBuilder sb=new StringBuilder("select count(*) from bus_room where status=0 and lease=1");
        if (type.equals("1")){
            sb.append(" and estateid =? ");
            objects.add(fcId);
        }else {
            sb.append(" and estateid in (select id from bus_real_estate where category=2 and status=0) ");
        }
        return dbUtils.getIntValue(sb.toString(),objects.toArray());
    }

    @Override
    public int getRoomRentCountByFloorId(Long floorId) {
        String sql="select count(*) from bus_room where status=0 and lease=1 and floorid=?";
        return dbUtils.getIntValue(sql,floorId);
    }

    /**
     * 根據房產id 或房產類型查詢戶型
     * @param stateId
     * @param type
     * @return
     */
    @Override
    public List<RoomType> getRoomTypeByStateId(Long stateId, String type) {
        if (type.equals("1")){
            String sql="select room_type,room_type_name from bus_room where status=0 and estateid =? group by  room_type,room_type_name";
            return dbUtils.query(sql, RoomType.class,stateId);
        }else {
            String sql="select room_type,room_type_name from bus_room where status=0 and estateid in (select id from bus_real_estate where status=0 and category=2) group by  room_type,room_type_name";
            return dbUtils.query(sql, RoomType.class);
        }
    }

    @Override
    public RoomRentDesResult getAllRentDes(Long stateId,String type) {
        if ("1".equals(type)){
            String sql="select sum(rent) as allrent, sum(deposit) as alldeposit from bus_room where estateid =? and status =0";
            return dbUtils.getFirst(sql, RoomRentDesResult.class,stateId);
        }
        String sql="select sum(rent) as allrent, sum(deposit) as alldeposit from bus_room where status =0 and estateid in (select id from bus_real_estate where status=0 and category=2)";
        return dbUtils.getFirst(sql, RoomRentDesResult.class);
    }

    @Override
    public List<BusRoom> getRoomByStateId(Long stateId, String type) {
        if (type.equals("1")){
            String sql="select * from bus_room where status=0 and estateid =? group by  room_type,room_type_name";
            return dbUtils.query(sql, BusRoom.class,stateId);
        }else {
            String sql="select *  from bus_room where status=0 and estateid in (select id from bus_real_estate where status=0 and category=2) group by  room_type,room_type_name";
            return dbUtils.query(sql, BusRoom.class);
        }
    }

    @Override
    public List<BusRoom> getRoomByStateId(Long stateId) {
        String sql="select *  from bus_room where status=0 and estateid = ?";
        return dbUtils.query(sql, BusRoom.class,stateId);
    }

    @Override
    public List<BusRoomTreeRes> getBusRoomTreeResByStateId() {
        String sql="select a.id,a.floorid,a.estateid,a.code,a.lease,(select count(*) from room_reservation where status=0 and room_id =a.id) as reservation ,(select name from house_lease where room_id=a.id and status=0 and lease_status<>2 ) name from bus_room a where a.status=0 and a.estateid in (select id from bus_real_estate where status=0 and category=2)";
        return dbUtils.query(sql, BusRoomTreeRes.class);
    }

    @Override
    public PageResult page(PageParam pageParam,BusRoomParam busRoomParam) {
        StringBuilder sb=new StringBuilder("select * from bus_room where 1=1 ");
        ArrayList<Object> param = CollectionUtil.newArrayList();
        if (ObjectUtil.isNotNull(busRoomParam)) {
            // 根据房间编号 查询
            if (ObjectUtil.isNotEmpty(busRoomParam.getCode())) {
               sb.append(" and code = ?");
               param.add(busRoomParam.getCode());
            }
        }
        return dbUtils.query(pageParam,sb.toString(),param.toArray());
    }

    @Override
    public List<BusRoom> list(BusRoomParam busRoomParam) {
        String sql="";
        return dbUtils.query(sql,BusRoom.class);
    }

    @Override
    public List<RoomListResult> getRoomListByEstateIdOnOwnerType(Long estateId, String name, int category) {
        Long id = estateId;
        List<RoomListResult> roomListResultList;
        if (category == 1){
            String sqlFloor="select * from bus_real_estate_floor where estateid =? and status = 0 order by code asc";
            roomListResultList = dbUtils.query(sqlFloor, RoomListResult.class, id);
        }else {
            String sql="select * from bus_real_estate where status=0 and category=2 ";
            roomListResultList = dbUtils.query(sql, RoomListResult.class);
        }
        if (category == 1){
            List<Long> ids=new ArrayList<>();
            roomListResultList.forEach(item->{
                ids.add(item.getId());
            });
            StringBuilder sql=new StringBuilder("select a.id,a.floorid,a.estateid,a.code,a.owner from bus_room a where a.floorid in (:ids) and a.status=0");
            HashMap<Object, Object> hashMap = CollectionUtil.newHashMap();
            hashMap.put("ids",ids);
            List<BusRoomTreeRes> busRooms = dbUtils.query(sql.toString(),BusRoomTreeRes.class,hashMap);
            roomListResultList.forEach(ite->{
                Long floorid;
                RoomItemResult itemResult;
                for (int i = 0; i < busRooms.size(); i++) {
                    floorid = busRooms.get(i).getFloorid();
                    if (ite.getId().equals(floorid)){
                        itemResult=new RoomItemResult();
                        itemResult.setId(busRooms.get(i).getId());
                        itemResult.setName(busRooms.get(i).getCode());
                        itemResult.setDisabled(busRooms.get(i).getOwner() == 1);
                        itemResult.setRoomStrName(name+"-"+busRooms.get(i).getCode());
                        ite.getList().add(itemResult);
                    }
                }

            });
        }else {
            String sql="select a.id,a.floorid,a.estateid,a.code,a.owner from bus_room a where a.status=0 and a.estateid in (select id from bus_real_estate where status=0 and category=2)";
            List<BusRoomTreeRes> busRooms =dbUtils.query(sql, BusRoomTreeRes.class);
            roomListResultList.forEach(ite->{
                Long stateid;
                RoomItemResult itemResult;
                for (int i = 0; i < busRooms.size(); i++) {
                    stateid = busRooms.get(i).getEstateid();
                    if (ite.getId().equals(stateid)){
                        itemResult=new RoomItemResult();
                        itemResult.setId(busRooms.get(i).getId());
                        itemResult.setName(busRooms.get(i).getCode());
                        itemResult.setDisabled(busRooms.get(i).getOwner() == 1);
                        itemResult.setRoomStrName(ite.getName()+"-"+busRooms.get(i).getCode());
                        ite.getList().add(itemResult);
                    }
                }

            });
        }
        return roomListResultList;
    }

    @Override
    public void add(BusRoomParam busRoomParam) {
        checkParam(busRoomParam,false);
        BusRoom busRoom = new BusRoom();
        BeanUtil.copyProperties(busRoomParam, busRoom);
        Long sysLoginUserId = LoginContextHolder.me().getSysLoginUserId();
        Date date = new Date();
        busRoom.setCreateTime(date);
        busRoom.setCreateUser(sysLoginUserId);
        busRoom.setLease(0);
        busRoom.setOwner(0);
        busRoom.setStatus(0);
        String strKey = dbUtils.insertKey(busRoom).toString();
        long key = Long.parseLong(strKey);
        /**
         * 押金列表
         */
        List<RoomDeposit> yjData = busRoomParam.getYjData();
        yjData.forEach(yj->{
            yj.setRoomid(key);
            yj.setCreateTime(date);
            yj.setCreateUser(sysLoginUserId);
            yj.setStatus(0);
            roomDepositService.addEntity(yj);
        });
        /**
         * 費用列表
         */
        List<RoomExpenses> fyData = busRoomParam.getFyData();
        // 租金水电是否分开收取（1 是 0不是）
        int hydropower = busRoomParam.getHydropower();
        fyData.forEach(fy->{
            fy.setRoomid(key);
            fy.setCreateTime(date);
            int type = fy.getType();
            if (hydropower == 0){
                fy.setYdzd(1);
            }else {
                if (type == 2){
                    fy.setYdzd(0);
                }
            }
            fy.setCreateUser(sysLoginUserId);
            fy.setStatus(0);
            roomExpensesService.addEntity(fy);
        });
        /**
         * 家私列表
         */
        List<RoomFurniture> jsData = busRoomParam.getJsData();
        jsData.forEach(js->{
            js.setRoomid(key);
            js.setCreateTime(date);
            js.setCreateUser(sysLoginUserId);
            js.setStatus(0);
            roomFurnitureService.addEntity(js);
        });
    }


    public void delete(BusRoomParam busRoomParam) {
        BusRoom busRoom = this.queryBusRoom(busRoomParam);
        if (busRoom.getLease() == 1){
            throw new BusinessException(0,"該房間有在租租約，請先退租");
        }
        if (busRoom.getOwner() == 1){
            throw new BusinessException(0,"該房間有業主租約，請先退租");
        }
        // 预约
        String ydSql="select count(*) from room_reservation where status=0 and  room_id=?";
        int intValue = dbUtils.getIntValue(ydSql, busRoomParam.getId());
        if (intValue>0){
            throw new BusinessException(0,"該房間有預約信息！");
        }
        String sql="update  bus_room set status=2,update_time=?,update_user=? where id =? ";
        dbUtils.execSql(sql,new Date(),LoginContextHolder.me().getSysLoginUserId(),busRoomParam.getId());
        roomDepositService.deleteYjByRoomId(busRoomParam.getId());
        roomExpensesService.deleteFyByRoomId(busRoomParam.getId());
        roomFurnitureService.deleteJsByRoomId(busRoomParam.getId());
    }

    public void edit(BusRoomParam busRoomParam) {
        checkParam(busRoomParam,true);
        BusRoom busRoom = this.queryBusRoom(busRoomParam);
        BeanUtil.copyProperties(busRoomParam, busRoom);
        Long sysLoginUserId = LoginContextHolder.me().getSysLoginUserId();
        Date date = new Date();
        busRoom.setUpdateTime(date);
        busRoom.setUpdateUser(sysLoginUserId);
        dbUtils.update(busRoom);
        Long id = busRoom.getId();
        /**
         * 押金列表
         */
        List<RoomDeposit> yjData = busRoomParam.getYjData();
        roomDepositService.deleteYjByRoomId(id);
        //在更新修改的

        //最后保存添加的

        yjData.forEach(yj->{
            yj.setId(null);
            yj.setRoomid(id);
            yj.setCreateTime(date);
            yj.setCreateUser(sysLoginUserId);
            yj.setStatus(0);
            roomDepositService.addEntity(yj);
        });
        /**
         * 費用列表
         */
        roomExpensesService.deleteFyByRoomId(id);
        List<RoomExpenses> fyData = busRoomParam.getFyData();
        // 租金水电是否分开收取（1 是 0不是）
        int hydropower = busRoomParam.getHydropower();
        fyData.forEach(fy->{
            fy.setId(null);
            fy.setRoomid(id);
            fy.setCreateTime(date);
            int type = fy.getType();
            if (hydropower == 0){
                fy.setYdzd(1);
            }else {
                if (type == 2){
                    fy.setYdzd(0);
                }
            }
            fy.setCreateUser(sysLoginUserId);
            fy.setStatus(0);
            roomExpensesService.addEntity(fy);
        });
        /**
         * 家私列表
         */
        roomFurnitureService.deleteJsByRoomId(id);
        List<RoomFurniture> jsData = busRoomParam.getJsData();
        jsData.forEach(js->{
            js.setId(null);
            js.setRoomid(id);
            js.setCreateTime(date);
            js.setCreateUser(sysLoginUserId);
            js.setStatus(0);
            roomFurnitureService.addEntity(js);
        });
    }

    @Override
    public void editByOwnerZy(Long roomId, Long ownerId) {
        String sql="update bus_room set owner =1, owner_id=?,update_time=?,update_user=? where id=?";
        dbUtils.execSql(sql,ownerId,new Date(), LoginContextHolder.me().getSysLoginUserId(),roomId);
    }

    @Override
    public void editByOwnerJc(Long ownerLeaseId) {
        String sql="update bus_room set owner =0, owner_id=null,update_time=?,update_user=? where owner_id =? and status=0 and  owner=1";
        dbUtils.execSql(sql,new Date(), LoginContextHolder.me().getSysLoginUserId(),ownerLeaseId);
    }

    @Override
    public BusRoom detail(BusRoomParam busRoomParam) {
        return this.queryBusRoom(busRoomParam);
    }

    @Override
    public int getRentRoomNumByFzId(Long fcId) {
        String sql="select count(*) from bus_room where status=0 and lease=1 and  estateid =?";
        return dbUtils.getIntValue(sql,fcId);
    }

    @Override
    public int getRentRoomNumByFloorId(Long fcId) {
        String sql="select count(*) from bus_room where status=0 and lease=1 and  floorid =?";
        return dbUtils.getIntValue(sql,fcId);
    }

    @Override
    public int getRentRoomNumByRoomId(Long fcId) {
        String sql="select count(*) from bus_room where status=0 and lease=1 and  id =?";
        return dbUtils.getIntValue(sql,fcId);
    }

    @Override
    public void deleteByFcId(Long id) {
        String sql="update  bus_room set status=2,update_time=?,update_user=? where estateid =? ";
        dbUtils.execSql(sql,new Date(), LoginContextHolder.me().getSysLoginUserId(),id);
    }

    @Override
    public void deleteRoomByStateId(Long id) {
        String selectSql="select * from bus_room where status=0 and estateid =?";
        List<BusRoom> query = dbUtils.query(selectSql, BusRoom.class, id);
        if (query.size()>0){
            String sql="update  bus_room set status=2,update_time=?,update_user=? where estateid =?  and status=0";
            dbUtils.execSql(sql,new Date(), LoginContextHolder.me().getSysLoginUserId(),id);
            query.forEach(item->{
                roomDepositService.deleteYjByRoomId(item.getId());
                roomExpensesService.deleteFyByRoomId(item.getId());
                roomFurnitureService.deleteJsByRoomId(item.getId());
            });
        }
    }

    @Override
    public void deleteRoomByFloorId(Long stateId, Long floorId) {
        String selectSql="select * from bus_room where status=0 and estateid =? and floorid = ?";
        List<BusRoom> query = dbUtils.query(selectSql, BusRoom.class, stateId, floorId);
        if (query.size()>0){
            String sql="update  bus_room set status=2,update_time=?,update_user=? where estateid =? and floorid = ? and status=0";
            dbUtils.execSql(sql,new Date(), LoginContextHolder.me().getSysLoginUserId(),stateId,floorId);
            query.forEach(item->{
                roomDepositService.deleteYjByRoomId(item.getId());
                roomExpensesService.deleteFyByRoomId(item.getId());
                roomFurnitureService.deleteJsByRoomId(item.getId());
            });
        }
    }

    /**
     * 获取房间表
     *
     * @author anti
     * @date 2021-04-16 19:14:02
     */
    private BusRoom queryBusRoom(BusRoomParam busRoomParam) {
        BusRoom busRoom = this.getById(busRoomParam);
        if (ObjectUtil.isNull(busRoom)) {
            throw new BusinessException(BusRoomExceptionEnum.NOT_EXIST);
        }
        return busRoom;
    }


    private void checkParam(BusRoomParam busRoomParam, boolean isExcludeSelf){
        Long id = busRoomParam.getId();
        Long estateid = busRoomParam.getEstateid();
        Long floorid = busRoomParam.getFloorid();
        String code = busRoomParam.getCode();
        int roomType = busRoomParam.getRoomType();
        //构建带name查询条件
        StringBuilder nameSb=new StringBuilder("select count(*) from bus_room where status =0 and estateid =? and code =? ");
        ArrayList<Object> nameParams = CollectionUtil.newArrayList();
        nameParams.add(estateid);
        nameParams.add(code);
        if (ObjectUtil.isNotEmpty(floorid)){
            nameSb.append(" and floorid = ? ");
            nameParams.add(floorid);
        }
        //如果排除自己，则增加查询条件主键id不等于本条id
        if (isExcludeSelf) {
            nameSb.append(" and id <> ?");
            nameParams.add(id);
            String sql="select count(*) from bus_room where status =0 and lease =1 and id =? ";
            int count = dbUtils.getIntValue(sql,id);
            if (count >= 1) {
                throw new BusinessException(0,"該房間已存在有效租約不允許修改");
            }
        }

        //查询重复记录的数量
        int countByName = dbUtils.getIntValue(nameSb.toString(),nameParams.toArray());

        //如果存在重复的记录，抛出异常，直接返回前端
        if (countByName >= 1) {
            throw new BusinessException(0,"該房間編號已存在");
        }
        // 裝配參數
        if (ObjectUtil.isNotEmpty(floorid)){
            //樓層
            BusRealEstateFloor floor = busRealEstateFloorService.getFloorById(floorid);
            busRoomParam.setFloor(floor.getName());
        }
        //戶型
        if (roomType==0){
            busRoomParam.setRoomTypeName("無戶型");
        }else {
            BasicInformation information = basicInformationService.getBasicInformationById(busRoomParam.getRoomType());
            if (ObjectUtil.isNotEmpty(information)){
                busRoomParam.setRoomTypeName(information.getName());
            }
        }
        String zqName = getZqName(busRoomParam);
        busRoomParam.setReceiptcycle(zqName);
    }

   public String getZqName(BusRoomParam busRoomParam){
        // 依据（字典 1日 2月 3年 4一次付清）
       int receiptyj = busRoomParam.getReceiptyj();
        // 付 （字典 付1-付18）
       int receiptfu = busRoomParam.getReceiptfu();
       // 押 （字典 押1-押18-自定义19）
       int receiptya = busRoomParam.getReceiptya();
       if (receiptyj == 4){
           return "一次付清";
       }
       String dw="月";
       if (receiptyj == 1){
           dw="日";
       }else if (receiptyj == 2){
           dw="月";
       }else if (receiptyj == 3){
           dw="年";
       }

       if (receiptya==19){
           return "付"+receiptfu+dw+" 押金自定義";
       }
       return "付"+receiptfu+dw+" 押"+receiptya+dw;
    }
}
